import pickle

'''
d = dict(name='Bob', age=20, score=88)

# 序列化
test=pickle.dumps(d)
print(test)
f = open('C:/Users/zhangyue/Desktop/test.txt', 'wb')
f.write(test)
f.close
'''


'''第二种方法
f = open('dump.txt', 'wb')
pickle.dump(d, f)
f.close()
'''


# 反序列化
#  1
'''
with open('C:/Users/zhangyue/Desktop/test.txt', 'rb') as g:
	h=g.read()
	temp=pickle.loads(h)
	print(temp)
'''
#  2 第二种方法
	
g=open('C:/Users/zhangyue/Desktop/test.txt', 'rb')
h=pickle.load(g)
g.close
print(h)



